#ifndef __PLAY_GAME_SCENE_H__
#define __PLAY_GAME_SCENE_H__

#include "cocos2d.h"
#include "BaseScene.h"
#include "GameObject.h"
#include <vector>

using namespace cocos2d;
using namespace std;

typedef enum
{
	MT_NONE = 0,
    MT_LEFT,
    MT_RIGHT,
    MT_UP,
    MT_DOWN
}MoveType_e;

class PlayGameLayer : public cocos2d::CCLayerColor
{
private:
	CCTMXTiledMap *m_pTileMap;
	CCTMXLayer *m_pTileMapBackground;
	GameObject *m_pPointer;	
	vector<vector<GameObject*>> m_pObjectMatrix;
	vector<vector<int>> m_pLevelMatrix;
	int m_iColumns;
	int m_iRows;
	void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
	void ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
	void ccTouchesMoved(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
	bool addObjectToScene();	
	bool allowMove(MoveType_e eMoveType);
	void Move(float x, float y, MoveType_e eMoveType);
	void GoToScene();
public:	
	PlayGameLayer();
	~PlayGameLayer();
	virtual bool init();
	CREATE_FUNC(PlayGameLayer);
};

class PlayGameScene : public BaseScene
{	
public:
	PlayGameScene():_layer(NULL){};
	~PlayGameScene();
    virtual bool init();  
	virtual void gameLoop(float time);
	CREATE_FUNC(PlayGameScene);
	CC_SYNTHESIZE_READONLY(PlayGameLayer*, _layer, Layer);
};

#endif  // __PLAY_GAME_SCENE_H__